/**
* @file        NaviConst
* @brief       
* @version     1.0.0
* @author      Changlin.Jing 
* @date        2023/8/23 16:34
* @copyright   Copyright  2022 Langge Software Co., Ltd. All rights reserved.
*/
#ifndef LANGGE_VDR_NAVICONST_H
#define LANGGE_VDR_NAVICONST_H
#include <cmath>
#include <string>

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define D2R         0.0174532925199433  /* deg to rad (PI/180.0)*/
#define R2D         57.29577951308232   /* rad to deg (180.0/PI)*/
#define AS2R        4.8481368111e-06    /* arc sec to radian (D2R/3600.0) */
#define RE_WGS84    6378137.0           /* earth semimajor axis (WGS84) (m) */
#define FE_WGS84    0.0033528106647474805  /* earth flattening (WGS84) (1.0/298.257223563)*/

//#define OMGE        7.2921151467E-5     /* earth angular velocity (IS-GPS) (rad/s) */
//#define HION        350000.0            /* ionosphere height (m) */
//#define MAXFREQ     7                   /* max NFREQ */
//#define CLIGHT      299792458.0         /* speed of light (m/s) */
//#define SC2RAD      3.1415926535898     /* semi-circle to radian (IS-GPS) */
//#define AU          149597870691.0      /* 1 AU (m) */

namespace constant {
    constexpr double WGS84_A = 6378137.0;/* 长半轴a */
    //const double WGS84_RB = 6356752.3142451793;    /* 短半轴b */
    //constexpr double WGS84_F = (1.0 / 298.257223563);//扁率
    constexpr double WGS84_AngleRate(7.2921151467E-5); /* 地球自转角速度*/
    constexpr double WGS84_GM(3.986005e14);/* 地球引力常数 */
    const double WGS84_E1 = 0.0066943799901413156; /* 第一偏心率平方 */
    //const double WGS84_E2 = 0.0067394967422764341; /* 第二偏心率平方 */

    constexpr double constant_wie = 7.2921151467e-5;/* 地球自转角速度*/
    constexpr double constant_g0 = 9.7803267715;
    //constexpr double constant_mg = 1e-3 * constant_g0;
    //constexpr double constant_ug = 1e-3 * constant_mg;
    constexpr double constant_mGal = 1e-5; // Gal = 1cm/s^2 ，mGal = 1e-3Gal=1e-5 m/s^2 = 1e-6g=1e-4 mg
    constexpr double constant_ppm = 1e-6;
    constexpr double constant_J2(0.00108263);
    constexpr double constant_J4(-2.37091222e-6);
    constexpr double constant_J6(6.08347e-9);

    //constexpr double dh2rs(4.8481368111e-06); //度每小时转弧度每秒 (M_PI / 180.0 / 3600.0)
    constexpr double rs2dh(206264.80624709636);    //弧度每秒转度每小时 (180.0 / M_PI * 3600.0)

    //C++11 新特性之operator "" xxx
    //    constexpr double operator"" _deg(long double x) { return x / 180 * M_PI; }
    //    constexpr double operator"" _hour(long double x) { return x * constant_hour; }
    //    constexpr double operator"" _mGal(long double x) { return x * constant_mGal; }
    //    constexpr double operator"" _g(long double x) { return x * constant_g0; }
    //    constexpr double operator"" _ppm(long double x) { return x * constant_ppm; }
    //    constexpr double operator"" _dh(long double x) { return x * dh2rs; } //deg/h
    //    constexpr double deg2rad = M_PI / 180;
    //    constexpr double rad2deg = 180 / M_PI;
    //    const std::string GPSTIMETAG = "GPSTIME_WEEK_TOW";
    //    const std::string MCUTIMETAG = "MCUTIME";

    //    constexpr double constant_hour = 3600;
    //    constexpr double constant_e_5(1.0e-5);
    //    constexpr double constant_e_6(1.0e-6);
    //    constexpr double constant_e5(1.0e5);
    //    constexpr double constant_e6(1.0e6);
    //    95分位数卡方分布表 //http://www.obhrm.net/index.php/%E5%8D%A1%E6%96%B9%E5%88%86%E5%B8%83%E8%A1%A8_Chi-Square_Probabilities
    //    const double chi_squared_test_table[100] =
    //            {0.00393214, 0.102586589, 0.351846318, 0.710723021, 1.145476226, 1.635382894,
    //             2.167349909, 2.732636793, 3.325112843, 3.940299136, 4.574813079, 5.226029488,
    //             5.891864338, 6.570631384, 7.260943928, 7.961645572, 8.671760205, 9.390455081,
    //             10.11701306, 10.85081139, 11.59130521, 12.33801458, 13.09051419, 13.84842503,
    //             14.61140764, 15.37915658, 16.15139585, 16.92787504, 17.70836618, 18.49266098,
    //             19.28056856, 20.07191346, 20.86653399, 21.66428071, 22.46501522, 23.26860902,
    //             24.07494256, 24.88390438, 25.6953904, 26.5093032, 27.32555147, 28.1440495,
    //             28.96471667, 29.78747708, 30.61225915, 31.43899527, 32.26762153, 33.09807743,
    //             33.93030562, 34.76425168, 35.59986394, 36.43709324, 37.2758928, 38.11621806,
    //             38.95802653, 39.80127763, 40.64593263, 41.49195448, 42.33930773, 43.18795845,
    //             44.03787413, 44.88902356, 45.74137684, 46.59490522, 47.4495811, 48.30537793,
    //             49.16227018, 50.02023325, 50.87924348, 51.73927805, 52.60031495, 53.46233296,
    //             54.3253116, 55.18923108, 56.05407229, 56.91981675, 57.78644661, 58.65394456,
    //             59.52229389, 60.39147839, 61.26148237, 62.13229063, 63.00388842, 63.87626144,
    //             64.74939583, 65.62327812, 66.49789524, 67.37323449, 68.24928355, 69.12603043,
    //             70.00346347, 70.88157134, 71.76034302, 72.63976779, 73.51983519, 74.40053508,
    //             75.28185754, 76.16379294, 77.04633186, 77.92946517};

} // namespace constant
#endif /* !CONSTANT_H_ */
